[cRow cCol] = size(c);
[lbRow lbCol] = size(lbounds);
[ubRow ubCol] = size(ubounds);

xC = [];
n = 1;
for ii=1:1:cRow
    if c(ii) ~= 0
        xC(n,1) = ii;
        n = n + 1;
    end
end

nUb = ubounds;

for ii=1:1:ubRow
    if ubounds(ii) == BIG
        nUb(ii) = NaN;
    else
        nUb(ii) = nUb(ii);
    end
end

AT = full(A);

for ii=1:1:ubRow
    if isnan(nUb(ii))
        ALEqual(ii,ii) = NaN;
    else
        ALEqual(ii,ii) = 1;
    end
end

AT = [AT;ALEqual];

bT = [b;nUb];
% bT = [b;ubounds];
% -----------------
for ii=1:1:lbRow
    AGEqual(ii,ii) = 1;
end
Aeq='N';
beq='N';

xlswrite('FORPLAN.xlsx', c, 'c');
xlswrite('FORPLAN.xlsx', AT, 'A(<=)');
xlswrite('FORPLAN.xlsx', bT, 'b(<=)');
xlswrite('FORPLAN.xlsx', AGEqual, 'A(>=)');
xlswrite('FORPLAN.xlsx', lbounds, 'b(>=)');
xlswrite('FORPLAN.xlsx', Aeq, 'Aeq');
xlswrite('FORPLAN.xlsx', beq, 'beq');

A2 = full(A);

clc;
tic
[x3,fval,exitflag] = linprog(c,A,b,[],[],lbounds,ubounds);
% [x2,fval2,exitflag2] = linprog(c,A2,b,[],[],lbounds,nUb);

% [x2,fval,exitflag] = linprog(c,AT,b,[],[],lbounds)
toc

n=1;
nX3=[];
for ii=1:1:cRow
    if ii == xC(n)
        if x3(ii) < 0.0001
            temp = 0;
        else
            temp = x3(ii);
        end
        nX3{n,1} = ['x' num2str(ii) ' = ' num2str(temp)];
        n = n + 1;
    end    
end

% xlswrite('XData.xlsx', nX2, 'x2');
nX3;